package com.yootk.server;
import java.net.*;

public class Y4 {
    public static void main(String[] args) throws Exception {
        DatagramSocket server = new DatagramSocket(8000); // 服务监听端口
        String message = "www.yootk.com"; // 待发送数据
        DatagramPacket packet = new DatagramPacket(message.getBytes(), 0, message.length(),
                InetAddress.getByName("localhost"), 9999); // 创建数据报
        server.send(packet); // 发送数据报
        System.out.println("【UDPServer】数据信息发送完毕 …");
        server.close(); // 关闭服务端
    }
}
